home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue35 / 35COM / AxDesktop_TLB.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-06-10  |  4.5 KB  |  163 lines

  1. unit AxDesktop_TLB;
  2.  
  3. { This file contains pascal declarations imported from a type library.
  4.   This file will be written during each import or refresh of the type
  5.   library editor.  Changes to this file will be discarded during the
  6.   refresh process. }
  7.  
  8. { AxDesktop Library }
  9. { Version 1.0 }
  10.  
  11. { Conversion log:
  12.   Hint: Class is not registered.  Ambient properties cannot be determined.
  13.  }
  14.  
  15. interface
  16.  
  17. uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
  18.  
  19. const
  20.   LIBID_AxDesktop: TGUID = '{1E5161AB-D086-11D1-8CDD-E61AF2D4AD0C}';
  21.  
  22. const
  23.  
  24. { Component class GUIDs }
  25.   Class_XDesktop: TGUID = '{1E5161AE-D086-11D1-8CDD-E61AF2D4AD0C}';
  26.  
  27. type
  28.  
  29. { Forward declarations: Interfaces }
  30.   IXDesktop = interface;
  31.   IXDesktopDisp = dispinterface;
  32.   IXDesktopEvents = dispinterface;
  33.  
  34. { Forward declarations: CoClasses }
  35.   XDesktop = IXDesktop;
  36.  
  37. { Dispatch interface for XDesktop Control }
  38.  
  39.   IXDesktop = interface(IDispatch)
  40.     ['{1E5161AC-D086-11D1-8CDD-E61AF2D4AD0C}']
  41.     function Get_Font: Font; safecall;
  42.     procedure Set_Font(const Value: Font); safecall;
  43.     function Get_ItemCount: Integer; safecall;
  44.     procedure Set_ItemCount(Value: Integer); safecall;
  45.     function Get_TextColor: TColor; safecall;
  46.     procedure Set_TextColor(Value: TColor); safecall;
  47.     function Get_TextBackgroundColor: TColor; safecall;
  48.     procedure Set_TextBackgroundColor(Value: TColor); safecall;
  49.     procedure AboutBox; safecall;
  50.     function Get_Visible: WordBool; safecall;
  51.     procedure Set_Visible(Value: WordBool); safecall;
  52.     property Font: Font read Get_Font write Set_Font;
  53.     property ItemCount: Integer read Get_ItemCount write Set_ItemCount;
  54.     property TextColor: TColor read Get_TextColor write Set_TextColor;
  55.     property TextBackgroundColor: TColor read Get_TextBackgroundColor write Set_TextBackgroundColor;
  56.     property Visible: WordBool read Get_Visible write Set_Visible;
  57.   end;
  58.  
  59. { DispInterface declaration for Dual Interface IXDesktop }
  60.  
  61.   IXDesktopDisp = dispinterface
  62.     ['{1E5161AC-D086-11D1-8CDD-E61AF2D4AD0C}']
  63.     property Font: Font dispid 1;
  64.     property ItemCount: Integer dispid 2;
  65.     property TextColor: TColor dispid 3;
  66.     property TextBackgroundColor: TColor dispid 4;
  67.     procedure AboutBox; dispid -552;
  68.     property Visible: WordBool dispid 5;
  69.   end;
  70.  
  71. { Events interface for XDesktop Control }
  72.  
  73.   IXDesktopEvents = dispinterface
  74.     ['{1E5161AD-D086-11D1-8CDD-E61AF2D4AD0C}']
  75.   end;
  76.  
  77. { XDesktopControl }
  78.  
  79.   TXDesktop = class(TOleControl)
  80.   private
  81.     FIntf: IXDesktop;
  82.     function GetControlInterface: IXDesktop;
  83.   protected
  84.     procedure CreateControl;
  85.     procedure InitControlData; override;
  86.     function GetTOleEnumProp(Index: Integer): TOleEnum;
  87.     procedure SetTOleEnumProp(Index: Integer; Value: TOleEnum);
  88.   public
  89.     procedure AboutBox;
  90.     property ControlInterface: IXDesktop read GetControlInterface;
  91.   published
  92.     property Font: TFont index 1 read GetTFontProp write SetTFontProp stored False;
  93.     property ItemCount: Integer index 2 read GetIntegerProp write SetIntegerProp stored False;
  94.     property TextColor: TColor index 3 read GetTColorProp write SetTColorProp stored False;
  95.     property TextBackgroundColor: TColor index 4 read GetTColorProp write SetTColorProp stored False;
  96.     property Visible: WordBool index 5 read GetWordBoolProp write SetWordBoolProp stored False;
  97.   end;
  98.  
  99. procedure Register;
  100.  
  101. implementation
  102.  
  103. uses ComObj;
  104.  
  105. procedure TXDesktop.InitControlData;
  106. const
  107.   CTFontIDs: array [0..0] of Integer = (
  108.     $00000001);
  109.   CControlData: TControlData = (
  110.     ClassID: '{1E5161AE-D086-11D1-8CDD-E61AF2D4AD0C}';
  111.     EventIID: '';
  112.     EventCount: 0;
  113.     EventDispIDs: nil;
  114.     LicenseKey: nil;
  115.     Flags: $00000000;
  116.     Version: 300;
  117.     FontCount: 1;
  118.     FontIDs: @CTFontIDs);
  119. begin
  120.   ControlData := @CControlData;
  121. end;
  122.  
  123. procedure TXDesktop.CreateControl;
  124.  
  125.   procedure DoCreate;
  126.   begin
  127.     FIntf := IUnknown(OleObject) as IXDesktop;
  128.   end;
  129.  
  130. begin
  131.   if FIntf = nil then DoCreate;
  132. end;
  133.  
  134. function TXDesktop.GetControlInterface: IXDesktop;
  135. begin
  136.   CreateControl;
  137.   Result := FIntf;
  138. end;
  139.  
  140. function TXDesktop.GetTOleEnumProp(Index: Integer): TOleEnum;
  141. begin
  142.   Result := GetIntegerProp(Index);
  143. end;
  144.  
  145. procedure TXDesktop.SetTOleEnumProp(Index: Integer; Value: TOleEnum);
  146. begin
  147.   SetIntegerProp(Index, Value);
  148. end;
  149.  
  150. procedure TXDesktop.AboutBox;
  151. begin
  152.   CreateControl;
  153.   FIntf.AboutBox;
  154. end;
  155.  
  156.  
  157. procedure Register;
  158. begin
  159.   RegisterComponents('ActiveX', [TXDesktop]);
  160. end;
  161.  
  162. end.
  163.